home *** CD-ROM | disk | FTP | other *** search
- #ifndef RJS_SIO_CLASS_H
- #define RJS_SIO_CLASS_H
-
- #include <iostream.h>
- #include <sys/ioctl.h>
-
- class RJS_Sio {
- public:
- enum SioMode { Page,NoPage};
- RJS_Sio(SioMode m=NoPage);
- ~RJS_Sio();
- static int print(const char *s);
- static int printl(const char *s);
- static int num_cols();
- static int num_lines();
- static void noecho();
- static void echo();
- static void cooked();
- static void cbreak();
- static void set_page_mode();
- static void clear_page_mode();
- static int get_page_mode();
- static void set_current_line(int l);
- static int get_current_line();
- static void get_tty(struct sgttyb &tty);
- static void set_tty(struct sgttyb &tty);
- private:
- static int more();
- static struct sgttyb savetty; // orignal tty
- static struct sgttyb ctty; // current tty
- static int ion; // inverse on
- static int uon; // underline on
- static int in_word; // in_word
- static SioMode page_mode; // prompt for "--more--"
- static int current_line; // current line printed
- static int cols; // number of columns
- static int lines; // number of lines
- static int initialized;
- static char buffer[256]; // buffer for escape strings
- static void init();
- static char *blink_on; // strings from termcap
- static char *bold_on;
- static char *cls;
- static char *delete_char;
- static char *delete_line;
- static char *erase_to_end_of_line;
- static char *erase_to_end_of_screen;
- static char *home;
- static char *inverse_on;
- static char *inverse_off;
- static char *plain;
- static char *restore_cursor;
- static char *save_cursor;
- static char *underline_on;
- static char *underline_off;
- };
-
- /************
-
- codes for print:
- \b bold on \B bold next word only
- \c cls
- \d delete character \D delete line
- \e erase to end of line \E erase to end of screen
- \f formfeed
- \g bell
- \h cursor home
- \i inverse on/off \I inverse next word only
- \l blink on \L blink next word only
- \n new line
- \p plain
- \r carriage return \R Restore cursor position
- \S Save cursor position
- \t horizontal tab
- \u underline on/off \U underline next word only
- \v vertical tab
-
- **************/
- #endif
-